import datetime
from applications.extensions import db


class BookInfo(db.Model):
    __tablename__ = 'book_info'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True, comment='图书ID')
    author = db.Column(db.String(128), comment='作者')
    publisher = db.Column(db.String(128), comment='出版社')
    publish_time = db.Column(db.Date, comment='出版时间')
    book_name = db.Column(db.String(128), comment='图书名称')
    book_type = db.Column(db.String(128), comment='图书类型')
    isbn = db.Column(db.String(128), unique=True, comment='ISBN号')
    add_time = db.Column(db.DateTime, default=datetime.datetime.now, comment='加入时间')
    book_stock = db.Column(db.Integer, comment='库存')
    book_inlibrary = db.Column(db.Integer, comment='在馆数')
    borrow_status = db.Column(db.Boolean, default=False, comment='借阅状态')
    price = db.Column(db.Float,comment='图书价格')